home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / QuickTime VR / MacOS / QuickDraw™ 3D 1.0.6F4 SDK / Development / Interfaces / QD3DCamera.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-11-14  |  9.9 KB  |  346 lines  |  [TEXT/MPS ]

  1. /******************************************************************************
  2.  **                                                                             **
  3.  **     Module:        QD3DCamera.h                                             **
  4.  **                                                                          **
  5.  **                                                                          **
  6.  **                                                                          **
  7.  **     Purpose:     Generic camera routines                                      **
  8.  **                                                                          **
  9.  **                                                                          **
  10.  **     Copyright (C) 1991-1995 Apple Computer, Inc. All rights reserved.     **    
  11.  **                                                                          **
  12.  *****************************************************************************/
  13. #ifndef QD3DCamera_h
  14. #define QD3DCamera_h
  15.  
  16. #ifndef QD3D_h
  17. #include <QD3D.h>
  18. #endif  /*  QD3D_h  */
  19.  
  20. #if PRAGMA_ONCE
  21.     #pragma once
  22. #endif
  23.  
  24. #if defined(__MWERKS__)
  25.     #pragma enumsalwaysint on
  26.     #pragma align_array_members off
  27.     #pragma options align=native
  28. #endif
  29.  
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif    /* __cplusplus */
  33.  
  34.  
  35. /******************************************************************************
  36.  **                                                                             **
  37.  **                            Data Structure Definitions                         **
  38.  **                                                                             **
  39.  *****************************************************************************/
  40. /*
  41.  *  The placement of the camera.
  42.  */
  43. typedef struct TQ3CameraPlacement{
  44.     TQ3Point3D        cameraLocation;        /*  Location point of the camera     */
  45.     TQ3Point3D        pointOfInterest;    /*  Point of interest                 */
  46.     TQ3Vector3D        upVector;            /*  "up" vector                     */
  47. } TQ3CameraPlacement;
  48.  
  49.  
  50. /*
  51.  *  The range of the camera.
  52.  */
  53. typedef struct TQ3CameraRange {
  54.     float    hither;        /*  Hither plane, measured from "from" towards "to"    */
  55.     float    yon;        /*  Yon  plane, measured from "from" towards "to"     */
  56. } TQ3CameraRange;
  57.  
  58.  
  59. /*
  60.  *  Viewport specification.  Origin is (-1, 1), and corresponds to the 
  61.  *  upper left-hand corner; width and height maximum is (2.0, 2.0),
  62.  *  corresponding to the lower left-hand corner of the window.  The
  63.  *  TQ3Viewport specifies a part of the viewPlane that gets displayed 
  64.  *    on the window that is to be drawn.
  65.  *  Normally, it is set with an origin of (-1.0, 1.0), and a width and
  66.  *  height of both 2.0, specifying that the entire window is to be
  67.  *  drawn.  If, for example, an exposure event of the window exposed
  68.  *  the right half of the window, you would set the origin to (0, 1),
  69.  *  and the width and height to (1.0) and (2.0), respectively.
  70.  *
  71.  */
  72. typedef struct TQ3CameraViewPort {
  73.     TQ3Point2D        origin;
  74.     float            width;
  75.     float            height;
  76. } TQ3CameraViewPort;
  77.  
  78.  
  79. typedef struct TQ3CameraData {
  80.     TQ3CameraPlacement    placement;
  81.     TQ3CameraRange        range;
  82.     TQ3CameraViewPort    viewPort;
  83. } TQ3CameraData;
  84.  
  85.  
  86. /*
  87.  *  An orthographic camera.
  88.  *
  89.  *  The lens characteristics are set with the dimensions of a
  90.  *  rectangular viewPort in the frame of the camera.
  91.  */
  92. typedef struct TQ3OrthographicCameraData {
  93.     TQ3CameraData        cameraData;
  94.     float                left;
  95.     float                top;
  96.     float                right;
  97.     float                bottom;
  98. } TQ3OrthographicCameraData;
  99.  
  100. /*
  101.  *  A perspective camera specified in terms of an arbitrary view plane.
  102.  *
  103.  *  This is most useful when setting the camera to look at a particular
  104.  *  object.  The viewPlane is set to distance from the camera to the object.
  105.  *  The halfWidth is set to half the width of the cross section of the object,
  106.  *  and the halfHeight equal to the halfWidth divided by the aspect ratio
  107.  *  of the viewPort.
  108.  * 
  109.  *  This is the only perspective camera with specifications for off-axis
  110.  *  viewing, which is desirable for scrolling.
  111.  */
  112. typedef struct TQ3ViewPlaneCameraData {
  113.     TQ3CameraData        cameraData;
  114.     float                viewPlane;
  115.     float                halfWidthAtViewPlane;
  116.     float                halfHeightAtViewPlane;
  117.     float                centerXOnViewPlane;
  118.     float                centerYOnViewPlane;
  119. } TQ3ViewPlaneCameraData;
  120.  
  121. /*
  122.  *    A view angle aspect camera is a perspective camera specified in 
  123.  *    terms of the minimum view angle and the aspect ratio of X to Y.
  124.  *
  125.  */
  126. typedef struct TQ3ViewAngleAspectCameraData {
  127.     TQ3CameraData        cameraData;
  128.     float                fov;
  129.     float                aspectRatioXToY;
  130. } TQ3ViewAngleAspectCameraData;
  131.  
  132.  
  133. /******************************************************************************
  134.  **                                                                             **
  135.  **                            Generic Camera routines                             **
  136.  **                                                                             **
  137.  *****************************************************************************/
  138.  
  139.  
  140. QD3D_EXPORT TQ3ObjectType Q3Camera_GetType(
  141.     TQ3CameraObject                camera);
  142.  
  143. QD3D_EXPORT TQ3Status Q3Camera_SetData(
  144.     TQ3CameraObject                camera,
  145.     const TQ3CameraData            *cameraData);
  146.  
  147. QD3D_EXPORT TQ3Status Q3Camera_GetData(
  148.     TQ3CameraObject                camera,
  149.     TQ3CameraData                *cameraData);
  150.     
  151. QD3D_EXPORT TQ3Status Q3Camera_SetPlacement(
  152.     TQ3CameraObject                camera,
  153.     const TQ3CameraPlacement    *placement);
  154.     
  155. QD3D_EXPORT TQ3Status Q3Camera_GetPlacement(
  156.     TQ3CameraObject                camera,
  157.     TQ3CameraPlacement            *placement);
  158.     
  159. QD3D_EXPORT TQ3Status Q3Camera_SetRange(
  160.     TQ3CameraObject                camera,
  161.     const TQ3CameraRange        *range);
  162.  
  163. QD3D_EXPORT TQ3Status Q3Camera_GetRange(
  164.     TQ3CameraObject                camera,
  165.     TQ3CameraRange                *range);
  166.  
  167. QD3D_EXPORT TQ3Status Q3Camera_SetViewPort(
  168.     TQ3CameraObject                camera,
  169.     const TQ3CameraViewPort        *viewPort);
  170.  
  171. QD3D_EXPORT TQ3Status Q3Camera_GetViewPort(
  172.     TQ3CameraObject                camera,
  173.     TQ3CameraViewPort            *viewPort);
  174.  
  175. QD3D_EXPORT TQ3Status Q3Camera_GetWorldToView( 
  176.     TQ3CameraObject                camera,
  177.     TQ3Matrix4x4                *worldToView);
  178.  
  179. QD3D_EXPORT TQ3Status Q3Camera_GetWorldToFrustum( 
  180.     TQ3CameraObject                camera,
  181.     TQ3Matrix4x4                *worldToFrustum);
  182.  
  183. QD3D_EXPORT TQ3Status Q3Camera_GetViewToFrustum(
  184.     TQ3CameraObject                camera,
  185.     TQ3Matrix4x4                *viewToFrustum);
  186.  
  187.  
  188. /******************************************************************************
  189.  **                                                                             **
  190.  **                            Specific Camera Routines                          **
  191.  **                                                                             **
  192.  *****************************************************************************/
  193.  
  194. /******************************************************************************
  195.  **                                                                             **
  196.  **                            Orthographic Camera                                  **
  197.  **                                                                             **
  198.  *****************************************************************************/
  199.  
  200. QD3D_EXPORT TQ3CameraObject Q3OrthographicCamera_New(
  201.     const TQ3OrthographicCameraData    *orthographicData);
  202.  
  203. QD3D_EXPORT TQ3Status Q3OrthographicCamera_GetData(
  204.     TQ3CameraObject                    camera,
  205.     TQ3OrthographicCameraData        *cameraData);
  206.  
  207. QD3D_EXPORT TQ3Status Q3OrthographicCamera_SetData(
  208.     TQ3CameraObject                    camera,
  209.     const TQ3OrthographicCameraData    *cameraData);
  210.  
  211. QD3D_EXPORT TQ3Status Q3OrthographicCamera_SetLeft(
  212.     TQ3CameraObject                    camera,
  213.     float                            left);
  214.     
  215. QD3D_EXPORT TQ3Status Q3OrthographicCamera_GetLeft(
  216.     TQ3CameraObject                    camera,
  217.     float                            *left);
  218.  
  219. QD3D_EXPORT TQ3Status Q3OrthographicCamera_SetTop(
  220.     TQ3CameraObject                    camera,
  221.     float                            top);
  222.     
  223. QD3D_EXPORT TQ3Status Q3OrthographicCamera_GetTop(
  224.     TQ3CameraObject                    camera,
  225.     float                            *top);
  226.  
  227. QD3D_EXPORT TQ3Status Q3OrthographicCamera_SetRight(
  228.     TQ3CameraObject                    camera,
  229.     float                            right);
  230.     
  231. QD3D_EXPORT TQ3Status Q3OrthographicCamera_GetRight(
  232.     TQ3CameraObject                    camera,
  233.     float                            *right);
  234.  
  235. QD3D_EXPORT TQ3Status Q3OrthographicCamera_SetBottom(
  236.     TQ3CameraObject                    camera,
  237.     float                            bottom);
  238.     
  239. QD3D_EXPORT TQ3Status Q3OrthographicCamera_GetBottom(
  240.     TQ3CameraObject                    camera,
  241.     float                            *bottom);
  242.  
  243.  
  244. /******************************************************************************
  245.  **                                                                             **
  246.  **                            ViewPlane Camera                                  **
  247.  **                                                                             **
  248.  *****************************************************************************/
  249.  
  250. QD3D_EXPORT TQ3CameraObject Q3ViewPlaneCamera_New(
  251.     const TQ3ViewPlaneCameraData    *cameraData);
  252.     
  253. QD3D_EXPORT TQ3Status Q3ViewPlaneCamera_GetData(
  254.     TQ3CameraObject                    camera,
  255.     TQ3ViewPlaneCameraData            *cameraData);
  256.  
  257. QD3D_EXPORT TQ3Status Q3ViewPlaneCamera_SetData(
  258.     TQ3CameraObject                    camera,
  259.     const TQ3ViewPlaneCameraData    *cameraData);
  260.  
  261. QD3D_EXPORT TQ3Status Q3ViewPlaneCamera_SetViewPlane(
  262.     TQ3CameraObject                    camera,
  263.     float                            viewPlane);
  264.     
  265. QD3D_EXPORT TQ3Status Q3ViewPlaneCamera_GetViewPlane(
  266.     TQ3CameraObject                    camera,
  267.     float                            *viewPlane);
  268.  
  269. QD3D_EXPORT TQ3Status Q3ViewPlaneCamera_SetHalfWidth(
  270.     TQ3CameraObject                    camera,
  271.     float                            halfWidthAtViewPlane);
  272.  
  273. QD3D_EXPORT TQ3Status Q3ViewPlaneCamera_GetHalfWidth(
  274.     TQ3CameraObject                    camera,
  275.     float                            *halfWidthAtViewPlane);
  276.  
  277. QD3D_EXPORT TQ3Status Q3ViewPlaneCamera_SetHalfHeight(
  278.     TQ3CameraObject                    camera,
  279.     float                            halfHeightAtViewPlane);
  280.  
  281. QD3D_EXPORT TQ3Status Q3ViewPlaneCamera_GetHalfHeight(
  282.     TQ3CameraObject                    camera,
  283.     float                            *halfHeightAtViewPlane);
  284.     
  285. QD3D_EXPORT TQ3Status Q3ViewPlaneCamera_SetCenterX(
  286.     TQ3CameraObject                    camera,
  287.     float                            centerXOnViewPlane);
  288.     
  289. QD3D_EXPORT TQ3Status Q3ViewPlaneCamera_GetCenterX(
  290.     TQ3CameraObject                    camera,
  291.     float                            *centerXOnViewPlane);
  292.     
  293. QD3D_EXPORT TQ3Status Q3ViewPlaneCamera_SetCenterY(
  294.     TQ3CameraObject                    camera,
  295.     float                            centerYOnViewPlane);
  296.     
  297. QD3D_EXPORT TQ3Status Q3ViewPlaneCamera_GetCenterY(
  298.     TQ3CameraObject                    camera,
  299.     float                            *centerYOnViewPlane);
  300.  
  301.  
  302. /******************************************************************************
  303.  **                                                                             **
  304.  **                            View Angle Aspect Camera                          **
  305.  **                                                                             **
  306.  *****************************************************************************/
  307.  
  308. QD3D_EXPORT TQ3CameraObject Q3ViewAngleAspectCamera_New(
  309.     const TQ3ViewAngleAspectCameraData    *cameraData);
  310.  
  311. QD3D_EXPORT TQ3Status Q3ViewAngleAspectCamera_SetData(
  312.     TQ3CameraObject                        camera,
  313.     const TQ3ViewAngleAspectCameraData    *cameraData);
  314.     
  315. QD3D_EXPORT TQ3Status Q3ViewAngleAspectCamera_GetData(
  316.     TQ3CameraObject                        camera,
  317.     TQ3ViewAngleAspectCameraData        *cameraData);
  318.  
  319. QD3D_EXPORT TQ3Status Q3ViewAngleAspectCamera_SetFOV(
  320.     TQ3CameraObject                        camera,
  321.     float                                fov);
  322.  
  323. QD3D_EXPORT TQ3Status Q3ViewAngleAspectCamera_GetFOV(
  324.     TQ3CameraObject                        camera,
  325.     float                                *fov);
  326.  
  327. QD3D_EXPORT TQ3Status Q3ViewAngleAspectCamera_SetAspectRatio(
  328.     TQ3CameraObject                        camera,
  329.     float                                aspectRatioXToY);
  330.     
  331. QD3D_EXPORT TQ3Status Q3ViewAngleAspectCamera_GetAspectRatio(
  332.     TQ3CameraObject                        camera,
  333.     float                                *aspectRatioXToY);
  334.  
  335.  
  336. #ifdef __cplusplus
  337. }
  338. #endif    /* __cplusplus */
  339.  
  340. #if defined(__MWERKS__)
  341. #pragma options align=reset
  342. #pragma enumsalwaysint reset
  343. #endif
  344.  
  345. #endif  /*  QD3DCamera_h  */
  346.